package com.dc.di.util;

import java.io.IOException;
import java.io.StringWriter;

import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;

public class XMLUtil {
	public static String parseXml(Element dom) {
		String result = null;
		try {
			StringWriter writer = new StringWriter();
			OutputFormat format = OutputFormat.createPrettyPrint();
			format.setExpandEmptyElements(true);
			format.setNewLineAfterDeclaration(false);
			format.setNewlines(false);
			format.setIndent(false);
			XMLWriter xmlwriter = new XMLWriter(writer, format);

			xmlwriter.write(dom);

			result = writer.toString();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return result;
	}

}
